from PIL import Image
import numpy as np



def load_src():
    #src_name=["50.jpg","100.jpg","125.jpg","160.jpg","200.jpg","250.jpg","320.jpg","400.jpg","500.jpg","640.jpg","800.jpg","1000.jpg","1250.jpg"]
    src_name = ["500.jpg","1250.jpg","3200.jpg"]
    src_img=[]
    path="./pic_src_1/"
    for index in range(len(src_name)):
        src_img.append(np.array(Image.open(path+src_name[index])))
    return src_img



# 按间距中的绿色按钮以运行脚本。
if __name__ == '__main__':
    img_list = []
    img_list=load_src()
    # for index in range(len(img_list)):
    #     print(img_list[index].shape)
    # a=img_list[1][:,:,0]
    # plt.imshow(a)
    # plt.show()
    # print(a.shape)
    # print(a)

    res=np.zeros(3456*4608*3,dtype=np.uint8).reshape(3456,4608,3)
    for index_t in range(3):
        for index_x in range(3456):
            for index_y in range(4608):
                tmp=0;
                for index_cnt in range(3):
                    tmp+=img_list[index_cnt][index_x][index_y][index_t]
                tmp/=3;
                res[index_x][index_y][index_t]=int(tmp)
            print(index_t,index_x,index_y)
    np.save("wei.npy",res)
    a=np.load("wei.npy")





